package com.anli1.Confog;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.scripting.support.ResourceScriptSource;

@Configuration
public class getLua {
    @Bean("Lua_test01")
    public DefaultRedisScript<Integer> getLuaTest01() {
        DefaultRedisScript<Integer> redisScript = new DefaultRedisScript<>();
        //resource目录下的scripts文件下的Lua_test01.Lua文件
        redisScript.setScriptSource(new ResourceScriptSource(new ClassPathResource("scripts/Qlua.Lua")));
        redisScript.setResultType(Integer.class);
        return redisScript;
    }
}
